namespace SimpleWebServices.Web.UI.Html
{
    using System;
    using SimpleWebServices.Web.UI.Html.Elements;

    public sealed class LabelledControl
    {
        public LabelledControl()
        {
        }

        public LabelledControl(IControl control)
            : this(control, null == control ? null as string : control.Title)
        {
        }

        public LabelledControl(IControl control, string label)
        {
            if (null == control)
            {
                throw new ArgumentNullException("control");
            }

            this.Control = control;
            this.Label = new Label(control, control.Title, label);
        }

        public IControl Control
        {
            get;
            set;
        }

        public Label Label
        {
            get;
            set;
        }
    }
}